window.onload=function(){
  //订单填写页面 号码处理
  //var oReceivingTel=document.getElementById("receivingTel");
  var oReceivingTel=document.getElementsByClassName("receivingTel");
  for(var i=0;i<oReceivingTel.length;i++){
    var oNum=oReceivingTel[i].innerHTML; 
    oReceivingTel[i].innerHTML=splitNum(oNum);
  }
  
//地址列表
    var iScoll=0;
    var moveX=0;
  var oAddressList=document.getElementsByClassName("addressEditable");
   var receivingCon=document.getElementsByClassName('receivingCon')[0];
    for(var i=0;i<oAddressList.length;i++){
  oAddressList[i].addEventListener("touchstart",function(event){
        event.preventDefault();
        iScoll=event.changedTouches[0].pageX;
  })
  oAddressList[i].addEventListener("touchmove",function(event){
    event.preventDefault();
      moveX=event.changedTouches[0].pageX-iScoll;
      if(moveX>0){
          this.style.WebkitTransform = "translateX(" + 0 + "px)";
      }
      else if(moveX<0){
        var l=Math.abs(moveX)
        this.style.WebkitTransform = "translateX(" + -l + "px)";
        if(l>240){
          l=240;
          this.style.WebkitTransform = "translateX(" + -l + "px)";
        }
      }
      
  })

  oAddressList[i].addEventListener("touchend",function(){
    moveX=event.changedTouches[0].pageX-iScoll;
    var transZRegex = /\.*translateX\((.*)px\)/i;
    var TransX=null;
    if(this.style.transform[1]){
    TransX=transZRegex.exec(this.style.transform)[1]; 
    }
    if(moveX==0 && (TransX==0 || TransX==null)){
        window.location.href="http://www.baidu.com";
        return;
      }
          
    if(moveX>-120){
      var l=0;
      this.style.WebkitTransform = "translateX(" + -l + "px)";
    }
    else{
      l=240;
      this.style.WebkitTransform = "translateX(" + -l + "px)";
    }
  })
}

var onOff=true;
$(document).ready(function(){
  $(".payNotes").click(function(){
     if(onOff){
      $(".payChoose").removeClass('payChoose01').addClass('payChoose02')
     }
     else{
        $(".payChoose").removeClass('payChoose02').addClass('payChoose')
     }
     onOff=!onOff;
    $(".chooseList").slideToggle("slow");
  });

  $(".delete01").on("touchend",function(){
    alert(1)
    $(this).parent().parent().remove();
    return;
  })
});
   //订单填写页
  /*var oPurchaseNum=document.getElementById("contentList");
  var oSub=oPurchaseNum.getElementsByClassName("listInfo");
  var oPrice=oPurchaseNum.getElementsByClassName("presentPrice");
  var OriginalPrice=oPurchaseNum.getElementsByClassName("originalPrice");
  var oNum=oPurchaseNum.getElementsByClassName("numOf");
  var oAll=document.getElementById("sumAll");
  var oBreaks=document.getElementById("breaks");
    function fn(){
      var oSumAll=0;
      for(var i=0;i<oSub.length;i++){
        oSumAll = oSumAll +parseInt(oPrice[i].innerHTML)*oNum[i].innerHTML.slice(1);
      }
      oAll.innerHTML="￥"+parseFloat(oSumAll);
    }
   fn();
    function preMonery(){
      var oPreMonery=0;
      for(var i=0;i<oSub.length;i++){
        oPreMonery = oPreMonery+parseInt(OriginalPrice[i].innerHTML)*oNum[i].innerHTML.slice(1);
      }
      oBreaks.innerHTML="￥"+parseFloat(oPreMonery);

    }
    preMonery();*/
}

//订单填写页面 号码处理
  function splitNum(str){
             var newStr=str.slice(0,3)+" "+str.slice(3,7)+" "+str.slice(7);
             return newStr
  }

